<template>
  <div class="wh-100 p-8" v-loading="loading" >
    <div class="wh-100 overflow-auto" style="background-color: white">
      <div class="w-100 d-flex-between-center pl-16 pr-16 bor-base-b h50">
        <div class="fs-14 fw-6">毕业生就业去向信息填报</div>
        <Button @click="goBack" style="background-color: white">返回</Button>
      </div>
      <div class="w-100  pl-32 bor-base-b mt-8">
        <Form class="formStyle "  label-position="right" :model="rowData" :label-width="labelWidth207">
          <FormItem
              label="学号" class="">
            <Input class="formItem-input" v-model="rowData.xh" disabled="true" placeholder=""></Input>
          </FormItem>
          <FormItem
              label="姓名" class="">
            <Input class="formItem-input" v-model="rowData.xm" disabled="true" placeholder=""></Input>
          </FormItem>
          <FormItem
              label="所在院系" class="">
            <Input class="formItem-input" v-model="rowData.xsh" disabled="true" placeholder=""></Input>
          </FormItem>
          <FormItem
              label="专业" class="">
            <Input class="formItem-input" v-model="rowData.major" disabled="true" placeholder=""></Input>
          </FormItem>
          <FormItem
              label="班级" class="">
            <Input class="formItem-input" v-model="rowData.szbj" disabled="true" placeholder=""></Input>
          </FormItem>
        </Form>
      </div>
      <div class="w-100  mt-12 ">
        <div class="w-65  " >
          <Form
              :model="destinationInformationForm"
              ref="destinationInformationRef"
              :rules="destinationInformationRules"
              label-position="right"
              :label-width="labelWidth240"
              class="mt-12"
          ><!--
                        <FormItem class="" prop="needReport" label="数据上报" key="0" style="width: 800px">
                            <Select  v-model="destinationInformationForm.needReport" placeholder="请选择">
                                <Option value="0">待上报</Option>
                                <Option value="1">已上报</Option>
                            </Select>
                        </FormItem>-->
            <FormItem class="cw800" :rules="[{ required: true, message: '该项必填', trigger: 'change', validator: validateOnetype,type:number}]" prop="onetype" label="就业状况" key="1" >
              <Select  v-model="destinationInformationForm.onetype" @on-change="employmentCategoryData($event)">
                <Option v-for="item in employmentSituation" :key="item.value" :value="item.value">
                  {{ item.title }}
                </Option>
              </Select>
            </FormItem>
            <FormItem
                :rules="[{ required: true, message: '该项必填', trigger: 'change', validator: validateType }]"
                v-loading="employmentCategoryDataLoading"
                prop="type"
                label="就业类别"
                key="2"
                class="cw800"
            >
              <el-cascader
                  :disabled="!destinationInformationForm.onetype"
                  @change="handleChange"
                  :show-all-levels="false"
                  v-model="destinationInformationForm.type"
                  size="small"
                  class="class01"
                  :options="employmentCategoryOptions"
                  :props="props"
                  :empty="'暂无数据'"
                  :placeholder="employmentCategoryText"
              >
                <template slot-scope="{ node, data }">
                  <span>{{ data.title }}</span>
                </template>
              </el-cascader>
            </FormItem>
            <div v-if="destinationInformationFormIsShow.dwmc" class="d-flex">
              <FormItem
                  :rules="[{ required: destinationInformationFormRequired.dwmc, message: '该项必填', trigger: 'blur' }]"
                  prop="dwmc"
                  :label="nameOfOrganizationLabel"
                  key="3"
                  class="cw800"
              >
                <div class="input-box" ref="clickDiv">
                  <Input v-model="destinationInformationForm.dwmc" :placeholder="destinationInformationFormPlaceholder.dwmc" @on-focus="focusNotarialCode" @on-change="remoteMethod"  />
                  <div class="ul-box" v-show="dwmcShow">
                    <ul class="ivu-select-dropdown-list" v-if="dwmcList && dwmcList.length > 0">
                      <li v-for="item in dwmcList" class="ivu-select-item" :key="item.code" @click="selectDwmc(item)">{{ item.name }}</li>
                    </ul>
                    <ul class="ivu-select-not-found" v-else>
                      <li>无匹配数据</li>
                    </ul>
                  </div>
                </div>
                <!--<Input v-model="destinationInformationForm.dwmc" :placeholder="destinationInformationFormPlaceholder.dwmc"  />-->
              </FormItem>
              <!--                            <div class="mt-8 ml-8 cursor-pointer" @click="visualizeInspection(destinationInformationForm.dwmc)">天眼查</div>-->
            </div>
            <FormItem
                v-if="destinationInformationFormIsShow.major"
                prop="major"
                label="升学专业"
                class="cw800"
                key="4"
                :rules="[{ required: destinationInformationFormRequired.major, message: '该项必填', trigger: 'blur' }]"
            >
              <Input v-model="destinationInformationForm.major" placeholder="请输入所学专业" />
            </FormItem>
            <FormItem
                v-if="destinationInformationFormIsShow.tyshxycode"
                :rules="[{ required: destinationInformationFormRequired.tyshxycode, trigger: 'blur', validator: validateOrganizingInstitutionBarCode }]"
                prop="tyshxycode"
                label="统一社会信用代码"
                key="5"
                class="cw800"
            >
              <Input v-model="destinationInformationForm.tyshxycode" maxlength="18" placeholder="请输入" />
            </FormItem>
            <FormItem
                v-if="destinationInformationFormIsShow.dwxz"
                :rules="[{ required: destinationInformationFormRequired.dwxz, message: '该项必填', trigger: 'change' }]"
                prop="dwxz"
                label="单位性质"
                key="6"
                class="cw800"
            >
              <Select v-model="destinationInformationForm.dwxz" >
                <Option v-for="item in natureOfUnitOptions" :value="item.value" :key="item.value">
                  {{ item.title }}
                </Option>
              </Select>
            </FormItem>
            <FormItem
                v-if="destinationInformationFormIsShow.dwhy"
                :rules="[{ required: destinationInformationFormRequired.dwhy, message: '该项必填', trigger: 'change' }]"
                prop="dwhy"
                label="单位行业"
                key="7"
                class="cw800"
            >
              <Select v-model="destinationInformationForm.dwhy" :placeholder="destinationInformationFormPlaceholder.dwhy">
                <Option v-for="item in unitIndustryOptions" :value="item.value" :key="item.value">
                  {{ item.title }}
                </Option>
              </Select>
            </FormItem>
            <FormItem
                v-if="destinationInformationFormIsShow.dwszd"
                v-loading="dwszdLoading"
                :rules="[{ required: destinationInformationFormRequired.dwszd, trigger: 'change', validator: validatelocationOfTheUnit }]"
                prop="dwszd"
                key="8"
                :label="locationOfTheUnitLabel"
                class="cw800"
            >
              <div v-if="unitLocationDisplay === true">
                <el-cascader
                    class="w-100 custom-placeholder"
                    v-model="destinationInformationForm.dwszd"
                    :placeholder="destinationInformationFormPlaceholder.dwszd"
                    :options="locationOfTheUnitList"
                    :props="provincesAndMunicipalitiesProps"
                >
                </el-cascader>
              </div>
              <div v-if="unitLocationDisplay === false">
                <el-cascader
                    class="w-100 custom-placeholder"
                    v-model="destinationInformationForm.dwszd"
                    :placeholder="destinationInformationFormPlaceholder.dwszd"
                    :options="provincesAndMunicipalitiesOptions"
                    :props="provincesAndMunicipalitiesProps"
                >
                </el-cascader>
              </div>
            </FormItem>
            <!--                        <FormItem v-if="showError">-->
            <!--                            <div>未找到匹配数据</div>-->
            <!--                        </FormItem>-->
            <FormItem
                v-if="destinationInformationFormIsShow.gzzwlb"
                :rules="[{ required: destinationInformationFormRequired.gzzwlb, message: '该项必填', trigger: 'change' }]"
                prop="gzzwlb"
                label="工作职位类别"
                key="9"
                class="cw800"
            >
              <Select v-model="destinationInformationForm.gzzwlb">
                <Option v-for="item in jobCategoryOptions" :value="item.value" :key="item.value">
                  {{ item.title }}
                </Option>
              </Select>
            </FormItem>
            <FormItem
                v-if="destinationInformationFormIsShow.dwlxr"
                :rules="[{ required: destinationInformationFormRequired.dwlxr, message: '该项必填', trigger: 'blur' }]"
                prop="dwlxr"
                label="单位联系人"
                key="10"
                class="cw800"
            >
              <Input v-model="destinationInformationForm.dwlxr" placeholder="请输入" />
            </FormItem>
            <FormItem
                v-if="destinationInformationFormIsShow.lxrdw"
                key="11"
                :rules="[
                                { required: destinationInformationFormRequired.lxrdw, message: '该项必填', trigger: 'blur' },
                                {
                                    pattern: /((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)/,
                                    message: '请输入正确的电话号码'
                                }
                            ]"
                prop="lxrdw"
                label="联系人电话"
                class="cw800"
            >
              <Input v-model="destinationInformationForm.lxrdw" placeholder="请输入" />
            </FormItem>
            <FormItem
                v-if="destinationInformationFormIsShow.dwdh"
                prop="dwdh"
                key="12"
                label="联系人手机"
                class="cw800"
                :rules="[{ pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/, message: '请输入正确的手机号' }]"
            >
              <Input v-model="destinationInformationForm.dwdh" placeholder="请输入" />
            </FormItem>
            <FormItem
                v-if="destinationInformationFormIsShow.lxremail"
                key="13"
                :rules="[
                                { required: destinationInformationFormRequired.lxremail, message: '该项必填', trigger: 'blur' },
                                { pattern: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/, message: '请输入正确的Email地址' }
                            ]"
                prop="lxremail"
                label="联系人Email"
                class="cw800"
            >
              <Input v-model="destinationInformationForm.lxremail" placeholder="请输入" />
            </FormItem>
            <FormItem v-if="destinationInformationFormIsShow.lxrfax" prop="lxrfax" label="联系人传真" key="14" class="cw800">
              <Input v-model="destinationInformationForm.lxrfax" placeholder="请输入" />
            </FormItem>
            <FormItem v-if="destinationInformationFormIsShow.dwdz" prop="dwdz" label="单位地址" key="15" class="cw800">
              <Input v-model="destinationInformationForm.dwdz" placeholder="请输入" />
            </FormItem>
            <FormItem
                v-if="destinationInformationFormIsShow.dwyb"
                key="16"
                :rules="[
                                { required: destinationInformationFormRequired.dwyb, message: '该项必填', trigger: 'blur' },
                                { pattern: /^(0[1-7]|1[0-356]|2[0-7]|3[0-6]|4[0-7]|5[1-7]|6[1-7]|7[0-5]|8[013-6])\d{4}$/, message: '请输入正确的邮政编码' }
                            ]"
                prop="dwyb"
                label="单位邮编"
                class="cw800"
            >
              <Input maxlength="6" v-model="destinationInformationForm.dwyb" placeholder="请输入" />
            </FormItem>
            <FormItem
                v-if="destinationInformationFormIsShow.zzhxz"
                key="17"
                label="月薪（税前）"
                class="cw800"
            >
              <InputNumber :max="99999999" :min="1" v-model="destinationInformationForm.zzhxz" placeholder="请输入"></InputNumber>
            </FormItem>
            <!--<FormItem-->
            <!--    v-if="destinationInformationFormIsShow.zzhxz"-->
            <!--    key="17"-->
            <!--    :rules="[ { required: destinationInformationFormRequired.zzhxz, message: '该项必填', trigger: 'blur' },]"-->
            <!--    prop="zzhxz"-->
            <!--    label="月薪（税前）"-->
            <!--    class="cw800"-->
            <!--&gt;-->
            <!--  <InputNumber :max="99999999" :min="1" v-model="destinationInformationForm.zzhxz" placeholder="请输入"></InputNumber>-->
            <!--  &lt;!&ndash;<Input v-model="destinationInformationForm.zzhxz" placeholder="请输入" />&ndash;&gt;-->
            <!--</FormItem>-->
            <!--                      扩充字段客户说不要，暂时隐藏，防止还要-->
            <!--                        <FormItem prop="extendWord1" label="扩充字段1" style="width: 800px">-->
            <!--                            <Input v-model="destinationInformationForm.extendWord1" placeholder="请输入"/>-->
            <!--                        </FormItem>-->
            <!--                        <FormItem prop="extendWord2" label="扩充字段2" style="width: 800px">-->
            <!--                            <Input v-model="destinationInformationForm.extendWord2" placeholder="请输入"/>-->
            <!--                        </FormItem>-->
            <!--                        <FormItem prop="extendWord3" label="扩充字段3" style="width: 800px">-->
            <!--                            <Input v-model="destinationInformationForm.extendWord3" placeholder="请输入"/>-->
            <!--                        </FormItem>-->
            <!--                        <FormItem prop="extendWord4" label="扩充字段4" style="width: 800px">-->
            <!--                            <Input v-model="destinationInformationForm.extendWord4" placeholder="请输入"/>-->
            <!--                        </FormItem>-->
            <!--                        <FormItem prop="extendWord5" label="扩充字段5" style="width: 800px">-->
            <!--                            <Input v-model="destinationInformationForm.extendWord5" placeholder="请输入"/>-->
            <!--                        </FormItem>-->
            <FormItem
                v-if="destinationInformationFormIsShow.enterpriseSize"
                prop="enterpriseSize"
                key="18"
                label="企业规模"
                class="cw800"
                :rules="[{ required: destinationInformationFormRequired.enterpriseSize, message: '该项必填', trigger: 'blur' }]"
            >
              <Input v-model="destinationInformationForm.enterpriseSize" placeholder="请输入企业规模多少人" />
            </FormItem>
            <FormItem
                v-if="destinationInformationFormIsShow.enterpriseRevenue"
                prop="enterpriseRevenue"
                key="19"
                label="企业营收"
                class="cw800"
                :rules="[{ required: destinationInformationFormRequired.enterpriseRevenue, message: '该项必填', trigger: 'blur' }]"
            >
              <Input v-model="destinationInformationForm.enterpriseRevenue" placeholder="请输入企业营收多少元/月" />
            </FormItem>
            <FormItem
                v-if="destinationInformationFormIsShow.isBaseEmployment"
                key="20"
                :rules="{ required: destinationInformationFormRequired.isBaseEmployment, message: '请选择是否基层就业', trigger: 'change', validator: validateBaseLevelOrNot }"
                prop="isBaseEmployment"
                label="是否基层就业"
                class="cw800"
            >
              <RadioGroup v-model="destinationInformationForm.isBaseEmployment">
                <Radio label="true">
                  <span>是</span>
                </Radio>
                <Radio label="false">
                  <span>否</span>
                </Radio>
              </RadioGroup>
            </FormItem>
            <FormItem
                v-if="destinationInformationFormIsShow.jwxxzwmc"
                key="21"
                prop="jwxxzwmc"
                label="留学院校中文名称"
                class="cw800"
                :rules="[{ required: destinationInformationFormRequired.jwxxzwmc, message: '该项必填', trigger: 'change' }]"
            >
              <Select filterable class="w-100" @on-change="getEnglishName" v-model="destinationInformationForm.jwxxzwmc" placeholder="请选择留学院校中文名称">
                <Option v-for="item in overseasInstitutionList" :value="item.chineseName">{{ item.chineseName }}</Option>
              </Select>
            </FormItem>
            <FormItem
                v-if="destinationInformationFormIsShow.jwxxwwmc"
                key="22"
                prop="jwxxwwmc"
                label="留学院校外文名称"
                class="cw800"
                :rules="[{ required: destinationInformationFormRequired.jwxxwwmc, message: '该项必填', trigger: 'blur' }]"
            >
              <Input v-model="destinationInformationForm.jwxxwwmc" placeholder="请输入留学院校外文名称" />
            </FormItem>
            <FormItem
                v-if="destinationInformationFormIsShow.lxgjdq"
                key="23"
                prop="lxgjdq"
                label="留学国家/地区"
                class="cw800"
                :rules="[{ required: destinationInformationFormRequired.lxgjdq, message: '该项必填', trigger: 'blur' }]"
            >
              <Input v-model="destinationInformationForm.lxgjdq" placeholder="请输入留学国家/地区" />
            </FormItem>
            <FormItem
                v-if="destinationInformationFormIsShow.lxzyzwmc"
                key="24"
                prop="lxzyzwmc"
                label="留学专业中文名称"
                class="cw800"
                :rules="[{ required: destinationInformationFormRequired.lxzyzwmc, message: '该项必填', trigger: 'blur' }]"
            >
              <Input class="w-100" v-model="destinationInformationForm.lxzyzwmc" placeholder="请输入留学专业中文名称" />
            </FormItem>
            <FormItem
                v-if="destinationInformationFormIsShow.lxzywwmc"
                prop="lxzywwmc"
                key="25"
                label="留学专业外文名称"
                class="cw800"
                :rules="[{ required: destinationInformationFormRequired.lxzywwmc, message: '该项必填', trigger: 'blur' }]"
            >
              <Input v-model="destinationInformationForm.lxzywwmc" placeholder="请输入留学专业外文名称" />
            </FormItem>
            <FormItem
                v-if="destinationInformationFormIsShow.lxxl"
                prop="lxxl"
                key="26"
                label="留学学历"
                class="cw800"
                :rules="[{ required: destinationInformationFormRequired.lxxl, message: '该项必填', trigger: 'change' }]"
            >
              <Select class="w-100" v-model="destinationInformationForm.lxxl" placeholder="请选择留学学历">
                <Option value="专科">专科</Option>
                <Option value="本科">本科</Option>
                <Option value="硕士">硕士</Option>
                <Option value="博士">博士</Option>
              </Select>
            </FormItem>
            <FormItem
                v-if="destinationInformationFormIsShow.zmcl"
                key="27"
                :rules="[{ required: destinationInformationFormRequired.zmcl, trigger: 'change', validator: validateEvidentiaryMaterial }]"
                prop="zmcl"
                label="证明材料"
                class="cw800"
            >
              <div class="d-flex">
                <uploadPicture :images="backImages" @beforeUpload="beforeUpload" @afterDelete="afterDelete" ref="supportingMaterialRef" :max-count="5"></uploadPicture>
              </div>
              <div class="tip-text">
                签协议就业请上传协议书附件； 签劳动合同就业请上传劳动合同附件； 有单位用人证明，请上传单位用人证明附件；升学请提供录取通知书附件； 出国、出境请提供出国护照附件
              </div>
              <div class="d-flex">
                <div class="fs-12" >高校毕业生毕业去向及相关证明材料说明。</div>
                <div class="fs-12" style="color: #1b7ef6" @click="materialDescription=true">点击查看</div>
              </div>
            </FormItem>

            <FormItem
                v-if="showButton"
                class="cw800"
            >
              <Button  @click="goBack">取消</Button>
              <Button class="ml-36 "  v-loading="btnLading"  type="primary" @click="submit">提交</Button>
            </FormItem>

          </Form>
        </div>
      </div>
    </div>
    <Modal  v-model="materialDescription" :footer-hide="true" :mask-closable="false"  class="tip-modal">
      <div slot="header" class="fs-16 fw-5">高校毕业生毕业去向及相关证明材料说明</div>
      <div class="wh-100 d-flex">
        <Menu  class="cw200" @on-select="changeExplainContent">
          <MenuItem v-for="item in explainList" :name="item.title" >{{item.title}}</MenuItem>
        </Menu>
        <div class=" h-100 pl-24 cw500">
          <div class="w-100 h-10 fs-16 fw-6">
            {{title}}
          </div>
          <div v-html="content" style="white-space: pre-wrap;word-wrap: break-word;" class="w-100 h-90 pt-12">
          </div>
        </div>
      </div>
    </Modal>
    <Modal  v-model="verifyModal" :footer-hide="true" :mask-closable="false" :width="700" class="">
      <div slot="header" class="fs-16 fw-5">{{ verifyTitle }}</div>
      <div class="wh-100 d-flex">
        {{verifyContent}}
      </div>
    </Modal>
  </div>
</template>
<script>
import UploadPicture from '../../../components/uploadPicture/uploadPicture.vue';
import {
  employmentCategoryAPI,
  employmentCategoryDataAPI,
  getUnitLocationListAPI, imageUploadDataApi,
  newProvincialDataApi,
  obtainEmploymentStatusDataAPI, overseasInstitutionDataApi,
  searchCompaniesDataAPI
} from '../../../api/bys';
import { copy, judgmentRequired, updateVal } from '../../../util/ObjectUtil';
import { getDictDataByType } from '../../../api';

import { saveOrUpdate,getByIdCard } from '../../../api/bys/jyqx/jyqx.js';


// region TODO 填报表单
const employmentCategory = ''; // 提交给后端时的就业类别
const destinationInformationRules = {};
const destinationInformationForm = {
  onetype: '', // 就业状况
  type: '', // 就业类别 当前选中的每级value
  dwmc: '', // 单位名称
  tyshxycode: '', // 组织机构代码
  dwxz: '', // 单位性质
  dwhy: '', // 单位行业
  dwszd: null, // 单位所在地
  dwszd1: null, // 单位所在地最后一级
  gzzwlb: '', // 工作职位类别
  dwlxr: '', // 单位联系人
  lxrdw: '', // 单位联系人电话
  dwdh: '', // 联系人手机
  lxrfax: '', // 联系人传真
  dwdz: '', // 单位地址
  dwyb: '', // 单位邮编
  zzhxz: 0, // 工资收入
  lxremail: '', //联系人Email
  extendWord1: '', // 扩充字段1
  extendWord2: '', // 扩充字段2
  extendWord3: '', // 扩充字段3
  extendWord4: '', // 扩充字段4
  extendWord5: '', // 扩充字段5
  zmcl: [], //证明材料
  isBaseEmployment: null, // 是否基层就业
  enterpriseSize: '', // 企业规模
  enterpriseRevenue: '', // 企业营收
  major: '', // 升学专业
  lxgjdq: '', // 留学国家/地区
  jwxxzwmc: '', //  学校中文名称
  jwxxwwmc: '', // 学校外文名称
  lxzyzwmc: '', // 留学专业中文名称
  lxzywwmc: '', // 留学专业外文名称
  lxxl: '', // 留学学历
  needReport: 0,
  type:'',
  status: 0,
};
const destinationInformationFormRequired = {
  onetype: false, // 就业状况
  type: false, // 就业类别 当前选中的每级value
  dwmc: false, // 单位名称
  tyshxycode: false, // 组织机构代码
  dwxz: false, // 单位性质
  dwhy: false, // 单位行业
  dwszd: false, // 单位所在地
  gzzwlb: false, // 工作职位类别
  dwlxr: false, // 单位联系人
  lxrdw: false, // 单位联系人电话
  dwdh: false, // 联系人手机
  lxrfax: false, // 联系人传真
  dwdz: false, // 单位地址
  dwyb: false, // 单位邮编
  zzhxz: false, // 工资收入
  lxremail: false, //联系人Email
  extendWord1: false, // 扩充字段1
  extendWord2: false, // 扩充字段2
  extendWord3: false, // 扩充字段3
  extendWord4: false, // 扩充字段4
  extendWord5: false, // 扩充字段5
  zmcl: false, //证明材料
  isBaseEmployment: false, // 是否基层就业
  enterpriseSize: false, // 企业规模
  enterpriseRevenue: false, // 企业营收
  major: false, // 升学专业
  lxgjdq: false, // 留学国家/地区
  jwxxzwmc: false, //  学校中文名称
  jwxxwwmc: false, // 学校外文名称
  lxzyzwmc: false, // 留学专业中文名称
  lxzywwmc: false, // 留学专业外文名称
  lxxl: false // 留学学历
};
const destinationInformationFormPlaceholder = {
  onetype: '请选择或输入', // 就业状况
  type: '请选择或输入', // 就业类别 当前选中的每级value
  dwmc: '请输入单位名称', // 单位名称
  tyshxycode: '请选择或输入', // 组织机构代码
  dwxz: '请选择或输入', // 单位性质
  dwhy: '请选择或输入', // 单位行业
  dwszd: '请选择或输入', // 单位所在地
  gzzwlb: '请选择或输入', // 工作职位类别
  dwlxr: '请选择或输入', // 单位联系人
  lxrdw: '请选择或输入', // 单位联系人电话
  dwdh: '请选择或输入', // 联系人手机
  lxrfax: '请选择或输入', // 联系人传真
  dwdz: '请选择或输入', // 单位地址
  dwyb: '请选择或输入', // 单位邮编
  zzhxz: '请选择或输入', // 工资收入
  lxremail: '请选择或输入', //联系人Email
  extendWord1: '请选择或输入', // 扩充字段1
  extendWord2: '请选择或输入', // 扩充字段2
  extendWord3: '请选择或输入', // 扩充字段3
  extendWord4: '请选择或输入', // 扩充字段4
  extendWord5: '请选择或输入', // 扩充字段5
  zmcl: '请选择或输入', //证明材料
  isBaseEmployment: '请选择或输入', // 是否基层就业
  enterpriseSize: '请选择或输入', // 企业规模
  enterpriseRevenue: '请选择或输入', // 企业营收
  major: '请选择或输入', // 升学专业
  lxgjdq: '请选择或输入', // 留学国家/地区
  jwxxzwmc: '请选择或输入', //  学校中文名称
  jwxxwwmc: '请选择或输入', // 学校外文名称
  lxzyzwmc: '请选择或输入', // 留学专业中文名称
  lxzywwmc: '请选择或输入', // 留学专业外文名称
  lxxl: '请选择或输入' // 留学学历
};

const destinationInformationFormIsShow = {
  onetype: false, // 就业状况
  type: false, // 就业类别 当前选中的每级value
  dwmc: false, // 单位名称
  tyshxycode: false, // 组织机构代码
  dwxz: false, // 单位性质
  dwhy: false, // 单位行业
  dwszd: false, // 单位所在地
  gzzwlb: false, // 工作职位类别
  dwlxr: false, // 单位联系人
  lxrdw: false, // 单位联系人电话
  dwdh: false, // 联系人手机
  lxrfax: false, // 联系人传真
  dwdz: false, // 单位地址
  dwyb: false, // 单位邮编
  zzhxz: false, // 工资收入
  lxremail: false, //联系人Email
  extendWord1: false, // 扩充字段1
  extendWord2: false, // 扩充字段2
  extendWord3: false, // 扩充字段3
  extendWord4: false, // 扩充字段4
  extendWord5: false, // 扩充字段5
  zmcl: false, //证明材料
  isBaseEmployment: false, // 是否基层就业
  enterpriseSize: false, // 企业规模
  enterpriseRevenue: false, // 企业营收
  major: false, // 升学专业
  lxgjdq: false, // 留学国家/地区
  jwxxzwmc: false, //  学校中文名称
  jwxxwwmc: false, // 学校外文名称
  lxzyzwmc: false, // 留学专业中文名称
  lxzywwmc: false, // 留学专业外文名称
  lxxl: false // 留学学历
};
// region TODO 就业状况下拉列表
const employmentSituation = [];
// endregion

// region TODO 就业类别下拉树
const employmentCategoryOptions = [];
// endregion

// region TODO 单位性质下拉列表
const natureOfUnitOptions = [];
// endregion

// region TODO 单位行业下拉列表
const unitIndustryOptions = [];
// endregion

// region TODO 工作职位类别下拉列表
const jobCategoryOptions = [];

const validateBaseLevelOrNot = (rule, value, callback) => {
  if (destinationInformationFormRequired.isBaseEmployment) {
    // if (destinationInformationForm.isBaseEmployment === null || !destinationInformationForm.isBaseEmployment) {
    //     callback(new Error('请选择是否基层就业'));
    // } else {
    //     callback();
    // }
    if(destinationInformationForm.isBaseEmployment && destinationInformationForm.isBaseEmployment.length > 0){
      callback();
    }else{
      callback(new Error('请选择是否基层就业'));

    }
  } else {
    callback();
  }
};
const validatelocationOfTheUnit = (rule, value, callback) => {
  if (destinationInformationFormRequired.dwszd) {
    if (destinationInformationForm.dwszd === null || destinationInformationForm.dwszd === '') {
      callback(new Error('请选择单位所在地'));
    } else {
      callback();
    }
  } else {
    callback();
  }
};
const validateOnetype = (rule, value, callback) => {
  if (destinationInformationForm.onetype.length > 0) {
    callback();
  } else {
    callback(new Error('该项必填'));
  }
};
const validateType = (rule, value, callback) => {
  if (destinationInformationForm.type.length > 0) {
    callback();
  } else {
    callback(new Error('该项必填'));
  }
};
let backImages = null;
export default {
  components: { UploadPicture },
  data(){
    return{
      validateEvidentiaryMaterial: (rule, value, callback) => {
        if (this.destinationInformationFormRequired.zmcl) {
          if (this.$refs.supportingMaterialRef.formFile.length > 0 || (this.destinationInformationForm.zmcl !== null && this.destinationInformationForm.zmcl !== '' && this.destinationInformationForm.zmcl.length > 0 )) {
            callback();
          } else {
            callback(new Error('请上传证明材料'));
          }
        } else {
          callback();
        }
      },
      validateOrganizingInstitutionBarCode: (rule, value, callback) => {
        if (this.destinationInformationFormRequired.tyshxycode) {
          const result = this.verify(this.destinationInformationForm.tyshxycode);
          if (result) {
            callback();
          } else {
            callback(new Error('请输入正确的组织机构代码'));
          }
        } else {
          callback();
        }
      },
      labelWidth207: 207,
      labelWidth240: 240,
      rowData: {},
      showError: false,
      showButton: false,
      loading: false,
      showSchoolLevelInformationOnly: false, //提示信息切换
      nameOfOrganizationLabel: '单位名称',
      locationOfTheUnitLabel: '单位所在地',
      employmentCategoryText: '请选择',
      employmentCategoryDataLoading: false,
      unitLocationDisplay: false, // 单位所在地显示
      locationOfTheUnitList: [], // 单位所在地
      showParticulars: true, //学生查看个人信息，清除按钮
      isDisabled:false,
      btnSaveLading: false,
      btnLading: false,
      employmentCategory,
      employmentSituation,
      destinationInformationForm,
      destinationInformationRules,
      destinationInformationFormRequired,
      destinationInformationFormPlaceholder,
      destinationInformationFormIsShow,
      natureOfUnitOptions,
      unitIndustryOptions,
      jobCategoryOptions,
      validateOnetype,
      validateType,
      validateBaseLevelOrNot,
      validatelocationOfTheUnit,
      employmentCategoryLoaing: true,
      dwszdLoading: false,
      props: {
        label: 'title',
        value: 'id',
        children: 'children'
      },
      employmentCategoryOptions,
      routeRow: [],
      overseasInstitutionList: [], //留学院校数据

      pageCurrent: 1,
      pageTotal: 0,
      pageParams: {
        pageNumber: 1, // 当前页数
        pageSize: 10, // 页面大小
        sort: 'createTime', // 默认排序字段
        order: 'desc' // 默认排序方式
      },
      // 省市区级联
      provincesAndMunicipalitiesProps: {
        label: 'name',
        value: 'code',
        children: 'children',
      },
      provincesAndMunicipalitiesOptions: [], //省市区select
      backImages, //回显数据
      materialDescription: false,
      title: '签就业协议形式就业',
      content:
          '(1)就业协议书或相关制式协议书\n' +
          '(2)录用接收函、公示材料\n' +
          '(3)定向、委培协议\n' +
          '(4)招收军士或文职人员协议书\n' +
          '(5)与规培基地签订的协议书\n' +
          '(6)国际组织出具的接收材料\n' +
          '(7)依据国(境)外用人单位出具的接收证明或出国签证文件\n',
      explainList:[
        {
          title: '签就业协议形式就业',
          content:
              '(1)就业协议书或相关制式协议书\n' +
              '(2)录用接收函、公示材料\n' +
              '(3)定向、委培协议\n' +
              '(4)招收军士或文职人员协议书\n' +
              '(5)与规培基地签订的协议书\n' +
              '(6)国际组织出具的接收材料\n' +
              '(7)依据国(境)外用人单位出具的接收证明或出国签证文件\n'
        },
        {
          title: '签劳动合同形式就业',
          content: '劳动合同'
        },
        {
          title: '其他录用形式就业',
          content:
              '用人单位出具的聘用证明或其他证明材料内容包括但不限于：\n' +
              '（1）不低于6个月的离校后聘用期限\n' +
              '（2）不低于当地最低工资标准的工资收入\n' +
              '（3）其他内容\n' +
              '用人单位出具的聘用证明或其他证明材料由院、校两级就业部门负责同志审核签字（盖章）\n'
        },
        {
          title: '科研助理、管理助理',
          content:
              '校、科研机构或企业出具的证明，内容包括但不限于：\n' +
              '（1）薪酬需达到当地最低工资标准\n' +
              '（2）其他\n' +
              '劳动(聘用)合同、协议书、接收函、商调函、《博士后研究人员备案证明》\n'
        },
        {
          title: '应征义务兵',
          content: '预定兵通知书或入伍通知书'
        },
        {
          title: '国家基层项目',
          content:
              '提供以下证明材料之一：\n' +
              '就业协议书、相关制式协议书、录用单位出具的录用文件、有关部门出具的接收证明、公示材料\n'
        },
        {
          title: '地方基层项目',
          content:
              '提供以下证明材料之一：\n' +
              '就业协议书、相关制式协议书、录用单位出具的录用文件、有关部门出具的接收证明、公示材料\n'
        },
        {
          title: '自主创业',
          content:
              '提供以下证明材料之一：\n' +
              '（1）创立企业的工商执照、股权证明、其他证明材料\n' +
              '（2）未创立公司，提供与孵化机构签订的协议或孵化机构提供的证明材料\n' +
              '（3）未创立公司，提供网店网址、网店信 息截图和交易流水等可反映网店正常经营状态的证明材料\n'
        },
        {
          title: '自由职业',
          content:
              '毕业生本人签字确认的证明材料，材料内容包括但不限于：\n' +
              '（1）从事的职业内容\n' +
              '（2）收入情况，收入需达到当地最低工资标准，\n' +
              '（3）其他\n' +
              '由院、校两级就业部门负责同志审核签字(盖章)\n'
        },
        {
          title: '境内、境外升学',
          content:
              '提供以下证明材料之一：\n' +
              '录取通知书、拟录取名单、录取院校调档函\n'
        },

      ],
      verifyModal:false,
      verifyContent:'',
      verifyTitle:'',
      jytype:[],
      dwmcList:[],
      loading1:false,
      dwmcShow:false
    }
  },
  methods: {
    handleClickOutside(event) {
      // 判断点击的位置是否在目标div之外
      if (!this.$refs.clickDiv.contains(event.target)) {
        this.outsideClicked();
      }
    },
    outsideClicked() {
      this.dwmcShow =false
      // 在这里执行您想要的操作
    },
    async getjyType() {
      let res = await employmentCategoryAPI()
      if (res.success) {
        console.log(res.result, '就业类别');
        this.jytype = res.result;
        return res.result
      }
    },
    afterDelete(){
      if(!(this.$refs.supportingMaterialRef.formFile.length > 0)){
        this.destinationInformationForm.zmcl = null
      }
      console.log(this.destinationInformationForm.zmcl);
      console.log(this.$refs.supportingMaterialRef.formFile);
      this.$refs.destinationInformationRef.validateField('zmcl');
    },
    beforeUpload(){
      this.$refs.destinationInformationRef.validateField('zmcl');
    },
    goBack(){
      this.$router.go(-1);
      // this.$router.replace({
      //   path:"/jyqxManage"
      // })
    },
    verifyMethod(){
      if (this.destinationInformationForm.type==2 ){
        if( this.destinationInformationForm.dwxz ==20 ||
            this.destinationInformationForm.dwxz ==21 ||
            this.destinationInformationForm.dwxz ==22 ||
            this.destinationInformationForm.dwxz ==23 ||
            this.destinationInformationForm.dwxz ==29){
          if(this.destinationInformationForm.dwmc.length>0){
            let mustEnd = ['院', '所', '校', '社', '馆', '台', '站', '中心', '园', '小学', '中学', '大学', '处', '局', '会', '队', '中', '小', '科', '厅', '林场', '少年宫', '校区', '管理署', '学区', '室', '部', '基地', '乐团']
            let endOne = this.destinationInformationForm.dwmc.slice(-1)
            let endTwo = this.destinationInformationForm.dwmc.slice(-2)
            let endThree = this.destinationInformationForm.dwmc.slice(-3)
            if(!mustEnd.includes(endOne) && !mustEnd.includes(endTwo) && !mustEnd.includes(endThree)){
              this.verifyModal=true
              this.verifyContent='事业单位名称是必须以：院,所,校,社,馆,台,站,中心,园,小学,中学,大学,处,局,会,队,中,小,科,厅,林场,少年宫,校区,管理署,学区,室,部,基地,乐团  结尾'
              this.verifyTitle='单位名称有误'
              return false
            }
          }
        }
      }

      return true
    },
    changeExplainContent(row){
      let itemRow=this.explainList.find(item => item.title === row)
      this.title = itemRow.title;
      this.content = itemRow.content;
    },
    async newObtainTheCascadingDataOfProvincesAndCities() {
      let res = await newProvincialDataApi()
      this.provincesAndMunicipalitiesOptions = res.result;
      console.log('new省市区res', res);

    },

    // endregion
    // region TODO 获取留学院校数据
    accessToStudyAbroadInstitutionData() {
      overseasInstitutionDataApi().then(res => {
        if (res.success) {
          this.overseasInstitutionList = res.result;
        }
      });
    },
    // endregion
    // region TODO 提交
    async submit() {
      // let verify = this.verifyMethod()
      // if(!verify){
      //     return
      // }
      this.$refs.destinationInformationRef.validate(async valid => {
        console.log(this.destinationInformationForm);
        if (valid) {
          let lengeh = null
          if(this.destinationInformationForm.dwszd && this.destinationInformationForm.dwszd !== null){
            lengeh = this.destinationInformationForm.dwszd.length - 1
          }
          if (this.destinationInformationFormRequired.zmcl && this.$refs.supportingMaterialRef.formFile.length > 0) {

            let zmcl=[]
            // for (const file of this.$refs.supportingMaterialRef.formFile) {
            //     // region TODO 上传证明材料
            //     const formData = new FormData();
            //     formData.append('file', file);
            //     const uploadResponse = await imageUploadDataApi(formData);
            //     if (uploadResponse.code == 200) {
            //         zmcl.push(uploadResponse.result)
            //     }
            // }
            for(let i=0;i<this.$refs.supportingMaterialRef.formFile.length;i++){
              let file=this.$refs.supportingMaterialRef.formFile[i];
              if(file.type){
                console.log('文件类型', file);
                // region TODO 上传证明材料
                const formData = new FormData();
                formData.append('file', file);
                const uploadResponse = await imageUploadDataApi(formData);
                if (uploadResponse.code == 200) {
                  this.$refs.supportingMaterialRef.formFile[i]=uploadResponse.result
                }
              }
            }
            zmcl=this.$refs.supportingMaterialRef.formFile
            if (this.employmentCategory == 11) {
              this.destinationInformationForm.dwmc = this.destinationInformationForm.jwxxzwmc;
            }
            this.btnLading = true
            const uploadResponse2 = await saveOrUpdate({
              ...this.destinationInformationForm,
              type: this.employmentCategory,
              id: this.rowData.id,
              zmcl: zmcl,
              dwszd1: lengeh===null? '': this.destinationInformationForm.dwszd[lengeh]
            });
            console.log(uploadResponse2,77);
            if (uploadResponse2.code == 200) {
              this.btnLading = false;
              // await this.$router.go(-1)
              this.$Message.success('提交成功');
              this.$router.push({
                name:'jyqxManage'
              })
            }

            // if (uploadResponse.code == 200) {
            //     this.destinationInformationForm.zmcl = uploadResponse.result;
            //     console.log('文件地址', uploadResponse);
            //     if (this.employmentCategory == 11) {
            //         this.destinationInformationForm.dwmc = this.destinationInformationForm.jwxxzwmc;
            //     }
            //
            //     const uploadResponse2 = await submitAPI({
            //         ...this.destinationInformationForm,
            //         type: this.employmentCategory,
            //         id: this.routeRow.id,
            //         procInstId: this.routeRow.procInstId,
            //         userid: this.routeRow.userid,
            //         eId: this.routeRow.eId,
            //         dwszd1: lengeh===null? '': this.destinationInformationForm.dwszd[lengeh]
            //     });
            //     if (uploadResponse2.code == 200) {
            //         await this.$router.push({ name: 'CareerDevelopmentAfterGraduation' });
            //         this.$Message.success('提交成功');
            //     }
            //     // endregion
            // }
          } else {
            this.btnLading = true;

            const uploadResponse2 = await saveOrUpdate({
              ...this.destinationInformationForm,
              type: this.employmentCategory,
              id: this.rowData.id,
              dwszd1: lengeh===null? '': this.destinationInformationForm.dwszd[lengeh]
            });
            if (uploadResponse2.code == 200) {
              this.btnLading = false;
              await this.$router.go(-1)
              this.$Message.success('提交成功');
            }
          }
        }
      });
    },
    // endregion

    // region TODO 查看详情
    particulars() {
      this.employmentCategoryData(this.rowData.onetype);
      this.$nextTick(() => {
        judgmentRequired(
            this.rowData.onetype,
            this.rowData.type,
            this.destinationInformationForm,
            this.destinationInformationFormRequired,
            this.destinationInformationFormPlaceholder,
            this.destinationInformationFormIsShow
        );
        updateVal(this.destinationInformationForm, this.rowData);
        this.employmentCategory = this.destinationInformationForm.type;
        console.log(this.destinationInformationForm.type ,1212);
        this.backImages = this.destinationInformationForm.zmcl;
        console.log('赋值图片', this.backImages);
        if(this.rowData.dwszd){
          if(this.rowData.dwszd.indexOf(",") != -1 ){
            let dwszd=this.rowData.dwszd.split(',') || '';
            this.destinationInformationForm.dwszd = dwszd
            // console.log(dwszd ,3,'dwszd');
            // this.destinationInformationForm.dwszd=[]
            // for(let item of dwszd){
            //   console.log(item)
            //   this.destinationInformationForm.dwszd.push(parseInt(item))
            // }
          }else{
            this.destinationInformationForm.dwszd=[]
            this.destinationInformationForm.dwszd.push(parseInt(this.rowData.dwszd))
          }
        }
        console.log(this.destinationInformationForm.dwszd ,"destinationInformationForm.dwszd");
        // region TODO 单位所在地是否只显示香港台湾澳门国外
        if (this.destinationInformationForm.onetype == 0) {
          if (this.destinationInformationForm.type == 22 || this.destinationInformationForm.type == 48) {
            this.unitLocationDisplay = true;
          }
        }
        console.log('单位所在地',  this.provincesAndMunicipalitiesOptions);

        //  处理单位所在地未成功回显
        if(this.destinationInformationForm.dwszd && this.destinationInformationForm.dwszd.length>0){
          let sheng=  this.provincesAndMunicipalitiesOptions.filter((item) => item.code == this.destinationInformationForm.dwszd[0])
          if(sheng.length>0){
            let shiList = sheng[0].children || [];
            let shi =shiList.filter((item) => item.code == this.destinationInformationForm.dwszd[1])
            this.destinationInformationFormPlaceholder.dwszd= shi[0].allName;
            if(shi.length>0){
              let qu = shi[0].children.filter((item) => item.code == this.destinationInformationForm.dwszd[2])
              this.destinationInformationFormPlaceholder.dwszd= shi[0].allName;
              if(qu.length>0){
                this.destinationInformationFormPlaceholder.dwszd= "请选择或输入"
              }
              this.showError = qu.length <= 0;
            }
          }
        }

        // endregion
        this.destinationInformationForm.isBaseEmployment = this.destinationInformationForm.isBaseEmployment == true ? 'true' :'false';
      });
      console.log(66666666);
    },
    // endregion
    // region TODO 根据留学院校中文回显英文
    getEnglishName() {
      this.destinationInformationForm.dwmc= this.destinationInformationForm.jwxxzwmc;
      const selectedChineseName = this.destinationInformationForm.jwxxzwmc;
      const matchedSchool = this.overseasInstitutionList.find(item => item.chineseName === selectedChineseName);
      if (matchedSchool) {
        this.destinationInformationForm.jwxxwwmc = matchedSchool.foreignName;
        this.destinationInformationForm.lxgjdq = matchedSchool.gjOrDq;
      }
    },
    // endregion


    // region TODO 获取就业状况数据
    obtainEmploymentStatusData() {
      return obtainEmploymentStatusDataAPI()
          .then(res => {
            this.employmentSituation = res.result || [];
            console.log(this.employmentSituation ,"jiuye");
          })
          .catch(e => {
            console.log(e);
          });
    },
    // endregion
    async remoteMethod( ){
      let arr = []
      this.loading1 = true;
      let query =this.destinationInformationForm.dwmc
      if (query ){
        this.dwmcShow =true
      }else {
        this.dwmcShow =false
      }
      await searchCompaniesDataAPI({unitName:query }).then(res=>{
        this.loading1 = false;
        if (res.code == 200) {
          if (res.result &&　res.result.length > 0) {
            arr=res.result
          }else {
            arr = []
          }
        } else {
          arr = [];
        }
      })
      this.dwmcList = arr
    },
    selectDwmc(e){
      if (e){
        this.dwmcShow = false
        let address = []
        if (e.address){
          this.provincesAndMunicipalitiesOptions.map(item=>{
            if (item.children && item.children.length > 0) {
              item.children.map(_item=>{
                if (_item.children &&_item.children.length > 0) {
                  _item.children.map(list=>{
                    if (list.code==e.address) {
                      address=[item.code ,_item.code ,list.code]
                    }
                  })
                }
              })
            }
          })
        }
        this.destinationInformationForm.dwszd =address
        this.destinationInformationForm.tyshxycode =e.code
        this.destinationInformationForm.dwlxr =e.contactPerson
        this.destinationInformationForm.lxrdw =e.contactPhone
        this.destinationInformationForm.dwhy =e.industry
        this.destinationInformationForm.dwdz =e.location
        this.destinationInformationForm.dwxz =e.nature
        this.destinationInformationForm.dwmc = e.name
      }
    },
    // region TODO 获取单位所在地
    async getUnitLocationList() {
      let res = await getUnitLocationListAPI()
      this.locationOfTheUnitList = res.result || [];
      console.log(res, 'wqewqe');
    },
    // endregion
    reSetData() {
      this.destinationInformationForm.dwmc = ''; // 单位名称
      this.destinationInformationForm.tyshxycode = ''; // 组织机构代码
      this.destinationInformationForm.dwxz = ''; // 单位性质
      this.destinationInformationForm.dwhy = ''; // 单位行业
      this.destinationInformationForm.dwszd = null; // 单位所在地
      this.destinationInformationForm.gzzwlb = ''; // 工作职位类别
      this.destinationInformationForm.dwlxr = ''; // 单位联系人
      this.destinationInformationForm.lxrdw = ''; // 单位联系人电话
      this.destinationInformationForm.dwdh = ''; // 联系人手机
      this.destinationInformationForm.lxrfax = ''; // 联系人传真
      this.destinationInformationForm.dwdz = ''; // 单位地址
      this.destinationInformationForm.dwyb = ''; // 单位邮编
      this.destinationInformationForm.zzhxz = ''; // 工资收入
      this.destinationInformationForm.lxremail = ''; //联系人Email
      this.destinationInformationForm.extendWord1 = ''; // 扩充字段1
      this.destinationInformationForm.extendWord2 = ''; // 扩充字段2
      this.destinationInformationForm.extendWord3 = ''; // 扩充字段3
      this.destinationInformationForm.extendWord4 = ''; // 扩充字段4
      this.destinationInformationForm.extendWord5 = ''; // 扩充字段5
      this.destinationInformationForm.zmcl = ''; //证明材料
      this.destinationInformationForm.isBaseEmployment = null; // 是否基层就业
      this.destinationInformationForm.enterpriseSize = ''; // 企业规模
      this.destinationInformationForm.enterpriseRevenue = ''; // 企业营收
      this.destinationInformationForm.major = ''; // 升学专业
      this.destinationInformationForm.lxgjdq = ''; // 留学国家/地区
      this.destinationInformationForm.jwxxzwmc = ''; //  学校中文名称
      this.destinationInformationForm.jwxxwwmc = ''; // 学校外文名称
      this.destinationInformationForm.lxzyzwmc = ''; // 留学专业中文名称
      this.destinationInformationForm.lxzywwmc = ''; // 留学专业外文名称
      this.destinationInformationForm.lxxl = ''; // 留学学历
    },

    // region TODO 获取就业类别
    employmentCategoryData(dictMatch) {
      this.$nextTick(() => {
        this.reSetData();
        if (dictMatch == 2) {
          this.nameOfOrganizationLabel = '学校名称';
          this.locationOfTheUnitLabel = '学校所在地';
        } else {
          this.nameOfOrganizationLabel = '单位名称';
          this.locationOfTheUnitLabel = '单位所在地';
        }
      });
      const _onetype = this.destinationInformationForm.onetype;
      this.$refs.destinationInformationRef.resetFields();
      this.destinationInformationForm.onetype = _onetype;
      //获取当前年份
      this.employmentCategoryDataLoading = true;
      // const year = new Date().getFullYear()
      const year = '2023';
      return employmentCategoryDataAPI({
        dictMatch: dictMatch,
        version: year
      }).then(res => {
        this.employmentCategoryOptions = res.result;
        console.log( res.result ,44444);
        this.employmentCategoryDataLoading = false;
        if (
            (this.$route.params?.operation || '') !== '查看' &&
            (this.$route.params?.operation || '') !== '驳回后填报' &&
            (this.$route.params?.operation || '') !== '撤回后填报' &&
            (this.$route.params?.operation || '') !== '信息填报申请' &&
            (this.$route.params?.operation || '') !== '保存后填报'
        ) {
          // this.$refs.supportingMaterialRef.deletePicture();
        }
      });
    },
    // endregion

    // region TODO 获取单位性质数据
    natureOfUnitData() {
      getDictDataByType('unit-nature').then(res => {
        this.natureOfUnitOptions = res.result || [];

      });
    },

    // endregion

    // region TODO 获取单位行业数据
    unitIndustryData() {
      getDictDataByType('unit-industry').then(res => {
        this.unitIndustryOptions = res.result || [];

      });
    },
    // endregion

    // region TODO 获取工作职位类别数据
    jobCategoryData() {
      getDictDataByType('job-position-category').then(res => {
        this.jobCategoryOptions = res.result || [];

      });
    },
    // endregion

    // region TODO 获取就业类别的选中ID
    handleChange(value) {
      this.dwszdLoading = true;
      this.$nextTick(() => {
        const formData = copy(this.destinationInformationForm);
        this.employmentCategory = value[value.length - 1];
        this.destinationInformationForm.type = this.employmentCategory;
        this.reSetData();
        judgmentRequired(
            formData.onetype,
            this.employmentCategory,
            this.destinationInformationForm,
            this.destinationInformationFormRequired,
            this.destinationInformationFormPlaceholder,
            this.destinationInformationFormIsShow
        );
        // region TODO 单位所在地是否只显示香港台湾澳门国外
        if (formData.onetype == 0) {
          if (this.employmentCategory == 22 || this.employmentCategory == 48) {
            this.unitLocationDisplay = true;
          } else {
            this.unitLocationDisplay = false;
          }
        } else {
          this.unitLocationDisplay = false;
        }
        // endregion
        this.dwszdLoading = false;
      });
      this.backImages = "";
      // this.$refs.supportingMaterialRef.deletePicture();
    },
    // endregion
    // region TODO 校验组织机构代码
    verify(value) {
      if (value.length == 15) {
        return false;
      } else {
        let reg = /(^[A-Za-z0-9]{18}$)/;
        return reg.test(value)


        // let reg = /(^(?:(?![IOZSV])[\dA-Z]){2}\d{6}(?:(?![IOZSV])[\dA-Z]){10}$)|(^\d{15}$)/;
        // return reg.test(value)
      }
    },
    // endregion

    // region TODO 天眼查
    visualizeInspection(name) {
      console.log('name', name);
      let url = 'https://www.tianyancha.com/search?key=' + name;
      window.open(url, '_blank');
    },
    // endregion
    onRestWindow() {
      this.labelWidth207 = this.searchLabelWidth(this.labelWidth207)
      this.labelWidth240 = this.searchLabelWidth(this.labelWidth240)
    },
  },
  async mounted() {
    this.onRestWindow();
    window.addEventListener('resize',this.onRestWindow);
    await this.getUnitLocationList();
    await this.newObtainTheCascadingDataOfProvincesAndCities();
    this.destinationInformationForm.onetype = ''
    this.loading = true;
    // this.destinationInformationForm.onetype = '';
    // this.destinationInformationForm.type = '';
    const paramsRow = sessionStorage.getItem('paramsRow') ? JSON.parse(sessionStorage.getItem('paramsRow')) : null;
    const row = this.$route.params.row || paramsRow;
    console.log(row,'这个是啥row');
    if (row) {
      if (row.type ==700) {
        row.type = ''
      }
      if (row.onetype ==5){
        row.onetype  = ''
      }
      console.log(row,"row");
      if(this.$route.params.row)sessionStorage.setItem('paramsRow',JSON.stringify(this.$route.params.row));
      if(this.$route.query.type == 0){
        this.showButton=true
        this.rowData = JSON.parse(JSON.stringify(row));
      }
      if(this.$route.query.type == 1){
        this.showButton=false
        this.rowData = row;
        this.rowData.xm = row.name
        this.rowData.xsh = row.college
        this.rowData.major = row.profession
        await this.getjyType()
        let [arr] = this.jytype.filter(e => e.profCode == row.type);
        this.rowData.type = arr ? arr.id : null;
        console.log( this.rowData.type ,"t54");
      }
      if (this.$route.query.type == 2){
        await getByIdCard({ idCard: this.$route.query.idCard }).then( async res => {
          this.showButton=false
          console.log(res.result);
          if (res.code == 200) {
            this.rowData =res.result
            this.rowData.xm = res.result.name
            this.rowData.xsh = res.result.college
            this.rowData.major = res.result.profession
            await this.getjyType()
            console.log(this.jytype,'jy');
            let [arr] = this.jytype.filter(e => e.profCode ==  res.result.type);
            this.rowData.type = arr ? arr.id : null;
          }else {
            this.$message.error(res.message)
          }
        })
        // this.showButton=false
        // this.rowData = row;
        // this.rowData.onetype = row.oneType
        // await this.getjyType()
        // let [arr] = this.jytype.filter(e => e.profCode == row.graduationCode);
        // this.rowData.type = arr ? arr.id : null;
        // this.rowData.dwmc = row.enterpriseName;
      }
      this.particulars();
    }
    console.log(this.destinationInformationForm.type ,"type");
    this.loading = false;
    this.obtainEmploymentStatusData();
    this.natureOfUnitData();
    this.unitIndustryData();
    this.jobCategoryData();
    this.accessToStudyAbroadInstitutionData();

    document.addEventListener('click', this.handleClickOutside);
  },
  beforeDestroy() {
    // window.sessionStorage.removeItem('paramsRow');// 清空缓存学生数据
    // window.sessionStorage.removeItem('key-row')
    window.removeEventListener('resize',this.onRestWindow)
    // 移除全局点击事件监听器
    document.removeEventListener('click', this.handleClickOutside);
  },
};
</script>
<style lang="less" scoped>
.h50 {
  height: 50px;
}
.cw800 {
  width: 800px;
}
.class01 {
  width: 100%;height: 20px
}
.tip-text {
  color:rgb(153, 153, 153);font-size: 12px;
}
.tip-modal {
  /deep/.ivu-modal{
    width: 700px !important;
  }
  /deep/.cw200 {
    width: 200px !important;
  }
}
.cw200 {
  width: 200px;
}
.cw500 {
  width: 500px;
}
</style>
<style  lang="less">
//form表单间距统一修改
.ivu-form-item {
  margin-bottom: 0.09rem !important;
}

.formStyle{
  width:800px;
  .formItem-input{
    width: 300px;
  }
  .formItem-input-area{
    width: 360px;
  }
}

.el-input__inner::placeholder {
  color: rgba(0,0,0,0.70);
}
.input-box {
  position: relative;
  .ul-box{
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 200px;
    overflow: auto;
    margin: 5px 0;
    padding: 5px 0;
    background-color: #fff;
    box-sizing: border-box;
    border-radius: 4px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, .2);
    z-index: 900;
  }
}
</style>
